use config::{Config, File, FileFormat};
use serde::Deserialize;

#[derive(Debug, Deserialize)]
pub struct Server {
    pub host: String
}
#[derive(Debug, Deserialize)]
pub struct Database {
    pub url: String
}

#[derive(Debug, Deserialize)]
pub struct Settings {
    pub debug: bool,
    pub production: bool,
    pub server: Server,
    pub database: Database
}

pub fn init_config() -> Config {
    Config::builder()
        .add_source(File::new("config.yaml", FileFormat::Yaml))
        .build()
        .unwrap()
}